<?php
class User_credit_model extends BZ_Model 
{
    protected $table   = 'user_credit';
    protected $table_2 = 'user';
    
    public function pageList($pgNum, $num, $params = [])
    {
        $this->db->select('a.*,b.user_name,b.mobile_phone');
        $this->db->from($this->table.' as a');
        $this->db->join($this->table_2.' as b','a.uid = b.uid');
        if (!empty($params['provider_id'])){
            $this->db->where('a.provider_id',$params['provider_id']);
        }
        $this->db->limit($pgNum, $num);
        $this->db->order_by('a.created_at','desc');
        return $this->db->get();
    }
}